<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

<ui:composition template="/WEB-INF/templates/principal/principal.xhtml">
	
	<ui:define name="content">
		<h2>Pacotes de Anuncios</h2>
		<p:separator/>
		<h:form id="formPacote">
			<p:dataTable id="tbPacotes" var="pacote" value="#{pacoteAnuncioManagedBean.pacotesAnuncios}">
				<p:column headerText="Pacote">					
					<h:outputText value="#{pacote.nome}"/>					
				</p:column>
				<p:column headerText="Anuncios" style="text-align:center">					
					<h:outputText value="#{pacote.qtdAnuncio}"/>  				
				</p:column>				
				<p:column headerText="Dias de anuncios" style="text-align:center">					
					<h:outputText value="#{pacote.diasAnuncio}"/>  				
				</p:column>				
				<p:column headerText="Valor" style="text-align:center">					
					<h:outputText value="#{pacote.valor}">
					   <f:convertNumber maxFractionDigits="2" minFractionDigits="2" pattern="R$ ###,###.##"/>
					</h:outputText>  				
				</p:column>
				<p:column headerText="Quantidade" style="text-align:center">					
					<p:spinner id="qtd" value="#{pacote.qtdComprado}" min="1" size="5"/>				
				</p:column>
				<p:column style="text-align:center">					
					<p:commandButton action="#{pacoteAnuncioManagedBean.salvarPacoteCliente}" value="Comprar" icon="ui-icon-cart">
						<f:setPropertyActionListener target="#{pacoteAnuncioManagedBean.pacoteAnuncioSelecionado}" value="#{pacote}" />
					</p:commandButton>				
				</p:column>
			</p:dataTable>		
		</h:form>
	</ui:define>
	
</ui:composition>
</html>